add basic pagination, could be improved by not using Array object