Pagination is flawed when it comes to interaction
Pagination is great in reducing visual load, but involves many functionality issues if records are to be interacted with.
Expected behaviour
You shouldn't select records that the user doesn't see. Doing so is an open door to malfunction (and sometimes data loss).
Use non ambiguous terms
select all
is not a good name for the button you are proposing. Something along the lines of select page
is much better if only records from the page are selected. You can obviously offer both buttons.
The phpMyAdmin solution
If you have been using phpMyAdmin in development phases of project, this issue pops many times - there are more than 30 records in a table, but only 30 are in the current view. Yet there is a user need to select all records in order to delete or modify them. The way this is achieved within phpMyAdmin is that the user has control over the amount of records per page. So you simply set it to the amount of records, select all, and do what you want.
The Developer's View
If you are designing a web app, you should really consult with your development team to see whether a feature such as select all records
is even possible to implement. In most cases, the pagination is done remotely, with only page records being loaded. So programmers may have extreme difficulties implementing a select all feature.