Fix pagination. 

This should fix a bug where memcache keys were being set incorrectly, as well as allow for slightly better caching, if you have pages which are multiples of each other.