Fix the paging order used by EntityPerPage.

The paging order needs to be id/type, not type/id, to
make good use of the database indexes. Attempts to
iterate over all page IDs where very slow, this change
should fix that.

Change-Id: I2b8dc080f03499e3818a03c8fb7a9b5b985aed5b
(cherry picked from commit f01661a239e88389d0926a90b63f59648ec518a7)