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;