I'd directly check the path. You're checking a set of circumstances that happen to only occur on a few pages, instead of checking something that can *only* occur on one page.