Properly escape %; actually use the loghost variable