The mantra you are referring to (the one that is found the link given in the question) is Ganapaty Gayatri mantra viz:
Aum Ekadantaya Viddhamahe, Vakratundaya Dhimahi, Tanno Danti
It is originally from the Mahanarayana Upanishad. The Upanishad has a separate section containing Gayatri mantras of various deities.
Ganapati Gayatri Mantra is found in Ganapati Atharvashirsha Upanishad.
Credits: Commentary on Ganapati Atharvashirsha Upanishad by Swami Tejomayananda
Edit: The mantra referred to in the link is correctly addressed by Rickross.
Your Question makes me find right now this puranic history:
The most Ignorant humans are, The Fiercest Gods do appear to them, in order to clean humans up from their impurities, when They do manifest in the physical appeareance in front of humans.
At the same time ...