Improve JModelLegacy::_getListCount() performance on JDatabaseQuery objects

Joomla currently uses unlimited query together with $db->getNumRows() to return total count. Unfortunately it has major performance penalty on large datasets, making queries very slow as @beat demonstrated in JAB13.

This pull request automatically optimizes all getListCount() calls to use COUNT(*) as long as JDatabaseQuery objects are used.