From 68933abfde509c786f2edbd84cb7303d1cbd2bb0 Mon Sep 17 00:00:00 2001 From: Henning Bostelmann Date: Sat, 29 Apr 2017 00:32:03 +0100 Subject: [PATCH] CONTRIB-6873 teacher view: adjust paging Prevent the paging offset from being beyond the list's end --- teacherview.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/teacherview.php b/teacherview.php index 7b248505..b7f056b1 100644 --- a/teacherview.php +++ b/teacherview.php @@ -438,6 +438,9 @@ function scheduler_print_schedulebox(scheduler_instance $scheduler, $studentid, $offset = 0; } } +if ($offset * $pagesize >= $sqlcount && $sqlcount > 0) { + $offset = floor(($sqlcount-1) / $pagesize); +} $slots = $scheduler->get_slots_for_teacher($teacherid, $currentgroup, $offset * $pagesize, $pagesize);