From 3bb4665841ccafd26ceecd8d6fff3f446feb19c5 Mon Sep 17 00:00:00 2001 From: John Okely Date: Thu, 18 Dec 2014 16:48:33 +0800 Subject: [PATCH] MDL-44560 glossary: Fix pagination on glossary category view Credit to Sebastian B for this fix --- mod/glossary/sql.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 28f372180fd..b5d432584ea 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -267,7 +267,13 @@ } break; } - $count = $DB->count_records_sql("SELECT COUNT(DISTINCT(ge.id)) $sqlfrom $sqlwhere", $params); + + $count = 0; + if ($tab == GLOSSARY_CATEGORY_VIEW && $hook == GLOSSARY_SHOW_ALL_CATEGORIES) { + $count = $DB->count_records_sql("SELECT COUNT(ge.id) $sqlfrom $sqlwhere", $params); + } else { + $count = $DB->count_records_sql("SELECT COUNT(DISTINCT(ge.id)) $sqlfrom $sqlwhere", $params); + } $limitfrom = $offset; $limitnum = 0;