Cast pagination values to integers in the JS. Fixes #1725