SOMERVILLE - A former educator has admitted that he secretly videotaped teenage boys in the shower at a Catholic high school in Somerville for nearly four years.

Patrick Lott pleaded guilty Wednesday to 30 counts of child endangerment and 29 counts of invasion of privacy. He faces up to six years in prison when he's sentenced Aug. 23.

Somerset County prosecutors say Lott videotaped students in a communal shower area at Immaculata High School, starting in January 2007.

Lott had been an assistant principal at the Bernardsville Middle School, but resigned in January 2012.