A utility function for pagination and filtering an array of data rows.