In mysql 4.0 there are two new functions that are implemented to take care of this from a database processing perspective. The first is SQL_CALC_FOUND_ROWS, and the second is FOUND_ROWS().
now gives you the total number of rows that would have been matched without the LIMIT in the first query. It's still two queries, but they are much more efficient.