From bb90211c9a20fe2315c013acdb14b112f93fb27f Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 6 Jan 2016 02:38:21 +0000 Subject: [PATCH] Fix nav when count < limit --- lib/php/db/table.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/php/db/table.php b/lib/php/db/table.php index c0113f2d..20bbef3a 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -363,6 +363,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. function nav($count,$tot,$limit) { $html = ''; + if ($count<$tot) { list($x,$y) = strpos($limit,',')!==false ? preg_split('/\s*,\s*/',$limit) @@ -373,6 +374,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. $next = $x + $y; $this->debug("x=$x limit=$y prev=$prev next=$next tot=$tot",1); + } else { $x = 0; $y = $tot; @@ -384,7 +386,7 @@ FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog. if ($prev>=0) $html .= '<< '; - $html .= ''.($tot ? ($x+1) : 0).' - '.($x+$y).' / '.$tot.' results'; + $html .= ''.($tot ? ($x+1) : 0).' - '.( $count<($x+$y) ? $count : ($x+$y) ).' / '.$tot.' results'; if ($next<$tot) $html .= ' >>'; -- 2.47.3