Public municipal toilets in Europe are staffed, just one person constantly keeping the place clean, and ready to call the police if anything like that goes on.
And it works. Certainly works better than having elevator shafts in MUNI and BART smell of excrement.