Further improvements to the Pagination class (added states and changed the behavior of generate() method)