I believe the links could possibly be fixed if you can remove all of the page# from them.
So for example if this is the link that becomes broken because it becomes on page 3 insyead of 2,
https://xenforo.com/community/threads/google-webp-support.76626/page-2#post-1435634
Then this should work by removing
page-2#
https://xenforo.com/community/threads/google-webp-support.76626/post-1435634
You may be able to do this with find and replace with an appropriate regex
This is a direct port of the original Post Content Find / Replace add-on for XF 1.x. You may wish to search the original resource discussion for solutions to common tasks performed with this add-on.
xenforo.com