Composed in Middle-Age France / Germany / Italy / England (c.1100 - c.1300 CE). Daat Zekenim is a Torah commentary compiled by later generations of scholars from the writings of the Franco-German school in the 12th-13th century (Ba’alei HaTosafot).
סדר רב עמרם גאון
הנכנס לבית הכנסת אומר : מה טובו אהליך יעקב משכנותיך ישראל. ואני ברב חסדך אבא ביתך אשתחוח אל היכל קדשך ביראתך:
כשיוצא אומר., ה׳ נחני בצדקתך למען שוררי הישר לפני דרכך;
Seder Rav Amram Gaon 9th Century, Sura, Babylonia
One who enters a synagogue says: "How goodly are thy tents, O Jacob, Thy dwellings, O Israel!" (Numbers 24:5). "But as for me, in the abundance of Thy lovingkindness will I come into Thy house; I will bow down toward Thy holy temple in the fear of Thee." (Psalms 5:8)
When leaving, say:
"O LORD, lead me in Thy righteousness because of them that lie in wait for me; Make Thy way straight before my face." (Psalms 5:10)
שו"ת מהרש"ל ס"ד
כשאני בא לבית הכנסת מתחיל אני בפסוק ואני ברוב חסדך ומדלג הפסוק הראשון מה טבו אהליך שאמרו בלעם, ואף הוא אמרו לקללה כדאיתא בפרק חלק (סנהרדין קה:ב) וגם אין כאן מקומו.
Maharshal (R. Shlomo Luria, 1510-1573, Poland) Responsa of Maharshal 64
When I come to synagogue I begin with the verse "But as for me, in the abundance of Thy lovingkindness..." (Psalms 5:8) and skip the first verse "How goodly are thy tents" (Numbers 24:5) because Balaam said it [first] and he said it as a curse as we find in Sanhedrin 105b, and this is not its proper place.
For when their husbands were tired through the crushing labour they used to bring them food and drink and induced them to eat. Then they would take the mirrors, and each gazed at herself in her mirror together with her husband, saying endearingly to him, “See, I am handsomer than you!” Thus they awakened their husbands’ affection and subsequently became the mothers of many children...And it was for this reason that the laver was made of them (the mirrors) — because it served the purpose of promoting peace between man and wife.