Please mention what that function returns, i.e. that clean_url is a URL which is suitable for putting it into a logfile.