Fixed bug #37 and added pagination show/hide logic