It's been years since I've had to do that, but when I asked the forum years ago, I was given a script and instructions. It had to do with using Hyperlinks, and if your pagination changed and you wanted to update the footnotes, you had to run the script again. Sorry that I can't tell you more, but maybe that will start you thinking on how you might do this on your own, or someone will help you better than I can. I have a different log-in at the forum now than I had then, but if you want to try to search for my old post, it would have been around 2009 or 2010, and my log-in back then was my name (Michael Gianino).
Please try text variable concept