The JPagination class allows developers to reliably and consistently add pagination to the Front-end and Back-end display of their components. The file containing the class can be found at /libraries/joomla/html/pagination.php.
The construct function of the class requires three variables:
$total - the total number of items in a list,
$limitstart - the offset of the item at which to start, and
$limit - the number of items to display per page.
In my case I wanted Pagination for the products. therefore in controller extend the joomla pagination class.
In our view.php we can use any of the 2 functions to display the pagination:
1.) getPagesLinks(): Returns an HTML string to display the Pages Links as << Start Prev 1 2 Next End >>
2.) getListFooter(): Returns a combination of the several page-related elements, including: the Display Limit dropdown, the Pages Links and the Pages Counter. Appearance differs in the Front-end and Back-end due to additional CSS formatting applied with the Khepri template.
Make sure that these functions are inside the form in your file specifically when using for back-end,