Fix STUD-1129: handle out-of-range page numbers
Merge pull request #2096 from edx/andya/pagination-fix

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