Add pagination.
Guard against invalid query parameters.