'Laravel pagination security

Do I need to validate the pagination parameters (page, perPage..)??

  • while writing some code with Laravel api I searched if there is any validation via Laravel code but it does not exists!! so do I need to take care of it?
public function index(PaginationRequest $request){
....
}


Solution 1:[1]

literally, you don't need any validation for pagination. But when you call the pagination and per page variable kindly add some default value. So that you cannot face any error.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dip Ghosh