Don't blindly call next_page_number() or previous_page_number().

The pagination methods have been changed to raise EmptyPageError if there's no
such page. We therefore can't blindly add things to the context, but rather
should check that the pages exist before we call these methods.

Testing done:
* Loaded the Review Board dashboard.
* Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/4587/