is the user clicking a link to the login page or being redirected to the login page based on an access rule?
if its a link, add a query string variable to the login page that contains the current page>
<a href="login.php?accesscheck=<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">Log in</a>
in the authenticate user behavior make sure the Go to Previous page option is checked.