The 47th prohibition is that we are forbidden from entertaining any thoughts1 which could lead one to accept ideas contrary to those of the Torah. Rather, we must control our thoughts and establish limits to what is acceptable, i.e. the commandments of the Torah and its prohibitions.2
The source of this commandment is G‑d's statement (exalted be He),3 "Do not turn after your heart and after your eyes."
In the words of the Sifri, "The phrase, 'do not turn after your heart,' refers to heresy, as in the verse,4 'I find more bitter than death [the woman5 whose heart is traps].' The phrase, 'and after your eyes,' refers to immoral behavior, as in the verse6 'And Shimshon said to his father [take her for me, for she is fitting in my eyes7].'" The word z'nus [translated above as, "immoral behavior"] includes pursuing physical pleasures and desires, and constantly thinking about them.