The general purpose way of doing this is to build each link with any existing get parameters (start with a copy of the existing $_GET
data) and add any new/changed get parameters that your process needs (you would add an 'id=x' parameter to indicate which record you are editing and possibly an 'action=edit' parameter.) Then on the edit page, you would build a 'Go Back' link without the get parameters that you added in the above. This will leave you with the pagination page number and any previous get parameters in the link.
If you build the pagination links in the same way, starting with a copy of any existing get parameters, your code will work if there is for an example a search term that is an input to the pagination code.
To get a post method form to propagate any existing get parameters, just leave the action='...' attribute out of the form tag.
An easy way of building the query string part of links is to use http_build_query() (this also urlencodes the values so that they won't break the url.)