fix when currentPage is major than pageCount, fix inserting a NaN in inputs

Thanks for all your work on this patch, I like having the validation here in the event handler. 

I think there's still a problem with the logic though - when someone puts in a valid page. Say there are 4 pages and the user puts in 3 - looks like it gets set to 1 in the session and 2 on the page. 

I think you just need to take out the -1 in the first line that parses the page number. Then currentPage is always 1-indexed and you just subtract 1 for setting it in the session.