From 36cb350ef1e45ec946242cb2c52b3f4d9004600a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 18 Nov 2002 19:21:09 +0000 Subject: - Don't display "1" when there is only one page. --- includes/pager.inc | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'includes') diff --git a/includes/pager.inc b/includes/pager.inc index a50937e9d..17a276b21 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -207,26 +207,29 @@ function pager_list($limit, $element = 0, $quantity = 5, $text = "") { } // end of generation loop preparation - $output = "$text"; - if ($i > 1) { - $output .= "... "; - } - - // finally we're ready to generate the actual pager piece - for (; $i <= $pager_last && $i <= $pager_max; $i++) { - if ($i < $pager_current) { - $output .= pager_previous($i, $limit, $element, ($pager_current - $i)) ." "; - } - if ($i == $pager_current) { - $output .= "$i "; + // when there is more than one page, create the pager list + if ($i != $pager_max) { + $output = "$text"; + if ($i > 1) { + $output .= "... "; } - if ($i > $pager_current) { - $output .= pager_next($i, $limit, $element, ($i - $pager_current)) ." "; + + // finally we're ready to generate the actual pager piece + for (; $i <= $pager_last && $i <= $pager_max; $i++) { + if ($i < $pager_current) { + $output .= pager_previous($i, $limit, $element, ($pager_current - $i)) ." "; + } + if ($i == $pager_current) { + $output .= "$i "; + } + if ($i > $pager_current) { + $output .= pager_next($i, $limit, $element, ($i - $pager_current)) ." "; + } } - } - if ($i < $pager_max) { - $output .= "..."; + if ($i < $pager_max) { + $output .= "..."; + } } return $output; -- cgit v1.2.3