Robustness - avoid possible divide by zero problem MDL-7425
This commit is contained in:
+5
-1
@@ -328,7 +328,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;
|
||||
|
||||
+5
-1
@@ -5334,7 +5334,11 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl, $pagevar='page
|
||||
$pagenum = $page - 1;
|
||||
$output .= ' (<a href="'. $baseurl . $pagevar .'='. $pagenum .'">'. get_string('previous') .'</a>) ';
|
||||
}
|
||||
$lastpage = ceil($totalcount / $perpage);
|
||||
if ($perpage > 0) {
|
||||
$lastpage = ceil($totalcount / $perpage);
|
||||
} else {
|
||||
$lastpage = 1;
|
||||
}
|
||||
if ($page > 15) {
|
||||
$startpage = $page - 10;
|
||||
$output .= ' <a href="'. $baseurl . $pagevar .'=0">1</a> ...';
|
||||
|
||||
Reference in New Issue
Block a user