SpecialAllPages: Fix a few subtle "Previous page" link bugs
* When finding the start of the previous page, exclude redirects if
"Hide redirects" is checked. Otherwise, if some of the previous 345
wiki pages were redirects, an equal number of results would be
repeated when going back.
* Use the DB key form of the title (not the unprefixed text form)
when building the query.
* Don't select unnecessary rows beyond the start of the previous page.
At the same time, fix a bug that could cause results close to the
beginning to be skipped when going back.
* When finding the start of the first page, don't omit ORDER BY for
MySQL and SQLite.
* Don't suppress the link when the unprefixed title is "0" or similar
or is numerically equal to the "from" parameter value.
* Suppress the link when the title would come after the "from"
parameter value, not just when it would be equal to that value.
Change-Id: I2cc6958b894afa824a5345871b5a27b01f9fcc73