Updated functions.php and login.php and 404.php

Added extra logic to cater for test-files with prefix 'new_' in the
filename, and added logic to make the logout-button behave properly when
logging out on a 404-page in a subdir