added checking for api logging when no HTTP_USER_AGENT is present, was throwing when empty