API: Fix ApiQueryBacklinks logic and use *_from_namespace

The original intent of this patch was to have ApiQueryBacklinks use the
*_from_namespace fields added in Icca99b6a. It does that, but in the
process several other bugs were found in the module:

* Continuation could skip pages when blredirect was used.
* The result object would be populated incorrectly if
  $wgAPIMaxResultSize was hit and blredirect was used.
* Continuation could (probably) skip or (maybe) repeat pages when
  blredirect was used and $wgAPIMaxResultSize was hit.

In the process of analyzing and fixing these problems, the code was
heavily refactored.

Change-Id: I32381c0f082d2f8e063af99ee353ae003c163c23
Merge "API: Fix ApiQueryBacklinks logic and use *_from_namespace"