Fix STUD-1129: handle out-of-range page numbers

Merged PR https://github.com/edx/edx-platform/pull/2096 to the RC.

@cahrens @cpennington Please review.