Fixes the repetition of the last page and add tests

In the current implementation there's a bug in the page validation
that makes the last page load twice. This update fixes this bug and closes #7.

I've also created some tests to prevent this kind of bug to happen again