Sansa has heard the sept's parishioners signing hymns to the gods ever since the first reports spotting Stannis's fleet.
Joffrey calls Sansa over and has her kiss his new sword, which he has named Hearteater despite it having eaten zero hearts.
Sansa goes to the sept and sings a hymn praying for those of King's Landing and her family far away. She adds a second prayer for the Hound.
She even prays for Joffrey, albeit she requests he doesn't make it back.
Sansa goes with the other ladies to Maegor's Holdfast, a castle within the Red Keep; the Queen's Ballroom is packed with women, children, and the elderly.
Sansa notices Ser Ilyn Payne among them.
Cersei enters and has Sansa seated by her. Sansa wonders why Ilyn is there, and Cersei says he is there to protect them in case the guards turn on them.
Sansa says a true knight would never harm a woman or child, and Cersei agrees. A true knight would not. But there isn't exactly a surplus of true knights during war.