fixed bug with possible undefined variable

since the logic statement above uses or, there are times when $has_uri is unset
using (!empty($has_uri)) instead of ($has_uri) prevents PHP throwing an error/warning