Preventing errors if there is no $_SERVER['SCRIPT_NAME']

On some environments, when running through CLI, I've encountered cases where there is no 'SCRIPT_NAME' global set.