Excavator was straddling the trench and tramming back to exit the area when the north side of the trench wall failed. This caused the excavator to fall over and into the trench, damaging the cab and trapping the operator inside for approximately 1.5 hours. Operator was safely evacuated with only minor injuries.