add pagination and supporting PHP code