Skip to content

Commit

Permalink
Various fixes in pages() function.
Browse files Browse the repository at this point in the history
git-svn-id: http://voip.null.ro/svn/ansql/trunk@135 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed Jan 13, 2015
1 parent c6ff685 commit 061ce6f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ function pages($total = NULL, $params = array())
$sp += $limit;
}
}
$pg_nr = $page/$limit + 1;
$pg_nr = floor($page/$limit)+1;
print '<font class="pagelink selected_pagelink" href="#">'.$pg_nr.'</font>&nbsp;&nbsp;';
if (($page+$limit) <= $total) {
if (($page+$limit) < $total) {
if($pg_nr >= 3)
$stop_at = $pg_nr + 2;
else
Expand All @@ -583,6 +583,10 @@ function pages($total = NULL, $params = array())

$next5 = $page + $limit*5;
$last_page = floor($total/$limit) * $limit;
if ($limit==1)
$last_page = $total - 1;
elseif (floor(($total/$limit))==$total/$limit)
$last_page = floor($total/$limit) * ($limit - 1);

/* jump 5 pages */
if ($next5 < $last_page)
Expand Down

0 comments on commit 061ce6f

Please sign in to comment.