Fix pager when close to the end of the number of pages.

Fixes [#9768](https://code.google.com/p/dart/issues/detail?id=9768).