Implement FOUND_ROWS
Currently there are a number of duplicate queries which are only used to determine pagination for Special pages, comments, etc. These queries can be improved with (and sped up by) combinations of SQL_CALC_FOUND_ROWS and $db->found_rows().