If your module has its own physical .aspx pages outside the content system (ie the content system is really just Default.aspx) then you should pass the moduleid and the pageid in the query string to your custom pages. Then (since query string can be manipulated) in your custom page you should verify that the module exists on the page and that the user has permission to view/edit the page or edit the module. There are helper functions in mojoBasePage you can use for this (see existing features for example code).
So maintaining these variable is important so you can maintain the security context of the page the user was on when he entered your feature and also it keeps the menu in sync as far as what page is highlighted as the active page. It also makes it easier to provide links back the content page where the user started.
Hope it helps,
Joe