| @@ -3,8 +3,17 @@ | ||
| 3 | 3 | namespace FluentBoards\App\Services; |
| 4 | 4 | |
| 5 | 5 | class Sanitize |
| 6 | 6 | { |
| 7 | + const MAX_PAGE_SIZE = 150; | |
| 8 | + | |
| 9 | + /** Bound list sizes while retaining the largest shared UI pagination choice. */ | |
| 10 | + public static function perPage($value, $maximum = self::MAX_PAGE_SIZE) | |
| 11 | + { | |
| 12 | + $value = is_scalar($value) ? (int) $value : 1; | |
| 13 | + return max(1, min((int) $maximum, $value)); | |
| 14 | + } | |
| 15 | + | |
| 7 | 16 | public static function campaign($data) |
| 8 | 17 | { |
| 9 | 18 | $fieldMaps = [ |
| 10 | 19 | 'title' => 'sanitize_text_field', |