diff --git a/libraries/src/MVC/Model/BaseDatabaseModel.php b/libraries/src/MVC/Model/BaseDatabaseModel.php index df56c291d0174..219142e7254e9 100644 --- a/libraries/src/MVC/Model/BaseDatabaseModel.php +++ b/libraries/src/MVC/Model/BaseDatabaseModel.php @@ -356,11 +356,11 @@ protected function _getListCount($query) // Otherwise fall back to inefficient way of counting all results. - // Remove the limit and offset part if it's a \JDatabaseQuery object + // Remove the limit, offset and order parts if it's a \JDatabaseQuery object if ($query instanceof \JDatabaseQuery) { $query = clone $query; - $query->clear('limit')->clear('offset'); + $query->clear('limit')->clear('offset')->clear('order'); } $this->getDbo()->setQuery($query);