Parse referer path only when it presents

This fixes errors when `request.referer` returns `nil`.