Added logic to alter the visible data when pagination controls are clicked. Added support for both local and remote pagination.