If the five buttons are links, then there is a CGI variable named CGI.HTTP_REFERER that contains the URL of the page from which you linked. If you need to trace this as the visitor travels throughout your site, then save it as a Session variable.
However, this won't work if your pages are in...