Fix off-by-one error affecting pagination

This was reorganized in 9d607400.
The var comparison was moved to after the var was incremented
but the offset wasn't adjusted accordingly.

Closes gh-608.
... and all the duplicates.