Cook pasta according to package directions to "al dente".
While pasta is cooking, saute mushrooms, onions and garlic in olive oil until tender, remove from heat to cool, do not drain.
Combine cottage cheese, ricotta, egg, herbs and seasonings.
Mix cooked pasta with sauce and sauteed onion mixture, and spoon half into bottom of 11x13-inch glass pan.
Spoon cheese mixture on top of pasta, spreading evenly to the edges. Put 1/2 cup mozzarella on top of cheese mixture. Place sliced pepperoni on top of cheese, then spread remaining pasta/onion/mushroom mixture, then mozzarella cheese.
Bake for 30-40 minutes, until cheese is browning and bubbly. Allow to rest at least 5 minutes before cutting.