You could check the current time with the last current time (the last page that was updated), and if it's above a certain threshold (say 5 minutes), then it would record them as having left and come back.
You could also make it log the user out after that threshold, and they'd get a new session, and you wouldn't have to worry about it.