Dozens of civilians have been killed and thousands others displaced amid ongoing battles between the Pakistani army and the Taliban near Islamabad.