Optimization of Secondary Wastewater Reuse to Minimize Environmental Risks