Algeria secured a place in the Afcon knockout stages with a 1-0 win over Burkina Faso, thanks to Riyad Mahrez's penalty.