Fix script name detection

Fixes the name detection when login enforcement is set. Works even when
ownCloud is installed on a subdirectory