Scenario when both pagination and the number of records to be shown in a page are combined

With both pagination and number of records to be shown in a page are implemented, if the user is in some 3rd page and changes the number of records to something higher, there could be situation where the number of pages is reduced to 2. Should the user be taken to the 2nd page in this case?

If yes, what if the number of pages is increased? In this case it is better the user is not taken to the last page.

Or in a better way, Could the user be taken to the first page in both the scenarios?
It would also be great if anyone could suggest a few better websites where pagination is implemented along with the number of records to be shown in a page.