Capture selection when pre-processing _paginated queries

This allows SELECT DISTINCT(mumble-mumble) queries to return correct counts in the pagination hash.