Added middleware to log last visit time and ip.