Changed Query::countByPk() - removes ORDER BY clause, because it's not needed for counting
Changed Query::count() - uses a copy of query instead of parsing the query to sql and performing the counting (#CR code review needed)