Added detection of the current page

Fixes the issue when the script would reload the purchase page on later stages (which it should not touch).