Skip to content

Commit

Permalink
ensure some sanitization takes place
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanta94 committed Jan 30, 2025
1 parent 91eb2ed commit 2b93e1c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ public static function fetch_first_where( string $where_clause, string $output =
*
* @return array The items.
*/
public static function paginate( array $args, int $per_page, int $page, string $output = OBJECT ): array {
public static function paginate( array $args, int $per_page = 20, int $page = 1, string $output = OBJECT ): array {
$per_page = min( max( 1, $per_page ), 200 );
$page = max( 1, $page );

$offset = ( $page - 1 ) * $per_page;

$orderby = $args['orderby'] ?? self::uid_column();
Expand Down

0 comments on commit 2b93e1c

Please sign in to comment.