From 7b0d5cd55134d1a92cf087dd4e8382c938b3ba6a Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 30 Aug 2007 06:01:57 +0000 Subject: [PATCH] Merged fixes for MDL-7425 from 1.8 stable --- course/category.php | 6 +++++- lib/weblib.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/course/category.php b/course/category.php index 25f02d240f..dc7cbb2c4a 100644 --- a/course/category.php +++ b/course/category.php @@ -342,7 +342,11 @@ // be moved up and down beyond the paging border if ($totalcount > $perpage) { $atfirstpage = ($page == 0); - $atlastpage = (($page + 1) == ceil($totalcount / $perpage)); + if ($perpage > 0) { + $atlastpage = (($page + 1) == ceil($totalcount / $perpage)); + } else { + $atlastpage = true; + } } else { $atfirstpage = true; $atlastpage = true; diff --git a/lib/weblib.php b/lib/weblib.php index 84e327cbd5..032076c9bc 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -5665,7 +5665,11 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl, $pagevar='page $output .= ' ('. get_string('previous') .') '; } } - $lastpage = ceil($totalcount / $perpage); + if ($perpage > 0) { + $lastpage = ceil($totalcount / $perpage); + } else { + $lastpage = 1; + } if ($page > 15) { $startpage = $page - 10; if (!is_a($baseurl, 'moodle_url')){ -- 2.39.5