There is “magic” _CTX global variable available from which you can access some context-specific values. Currently the following keys are available:
_CTX
_CTX.currentPage