Just thinking out loud, so don't should me if it doesn't work.
I guess you could create an application item for the home page on which your user lands after login. You can use the code you allready created to set the page number in that application item.
You can than refer to that application item in your application's Home URL, which you can set under shared components > globalization > globalization attributes > user interface > user interfaces. In the home URL you can refer to your application item using the &MY_APP_ITEM. notation.
Hope it works for you