You should probably check that $referrer['host'] exists, in case someone supplies a malformed referrer URL