magento2.1.0 – How to Set Pagination in Product Review Tab in Magento 2

magento2.1.0

I want to set pagination in product review tab.
So if I have 30 reviews for particular product, then in reviews tab I want the pagination from 1 to 5 with next and previous buttons and in all pages I want to show only 5 review/page.

On this path vendor/magento/module-review/Block/Product/View I got block file ListView.php. File code is below.

protected function _prepareLayout()
{
    parent::_prepareLayout();

    $toolbar = $this->getLayout()->getBlock('product_review_list.toolbar');
    if ($toolbar) {
        $toolbar->setCollection($this->getReviewsCollection());
        $this->setChild('toolbar', $toolbar);
    }

    return $this;
}

Above is the review collection code so how to change this code so I can set pagination?

Best Answer

Magento 2 Default provide Pagination in Review Tab. If you want to Set Limit in review than change in below file.  
   vendor/magento/module-theme/Block/Html/Pager.php

find Below Code in Pager.php

 protected $_availableLimit = [10 => 10, 20 => 20, 50 => 50];

Replace With 

 protected $_availableLimit = [5 => 5, 10 => 10, 25 => 25];

It's Working to Set Limit in Review Tab.