Flanking damage bonus?

So I was testing out my upgraded Hoplites vs a Barbarian village. (+3 Dmg, +2 Arm).
All the way from 1 through 25 Clubmen stacks my Hoplites suffered no casualties and their HP never went below 96% in these first 7 battles. Great I thought, this armour is really doing its job well.
So I send my 30 Hoplites vs the 35 Clubmen thinking it'll be a walk in the park again.
I was very surprised to suddenly see that I took 1 casualty and was at 99% HP now.
My Hoplites killed 25 clubmen in front and the 5 flanking ones in the first round, and then finished off the remaining 5 in the 2nd round with only 1% further damage taken.

How did the barbarians suddenly go from tickling me for 4% damage to killing off an entire 56HP Hoplite? What am I missing here?

Well you're missing the math.
Hops have 1 armor base, so yours have 3.
Clubmen does 5 dmg. Since armor is directly deducted, the effective dpr of clubmen in your occasion is 2, making total damage dealt in the first attack 50.
50 obviously isn't enough to kill a hoplite, and thus you didn't loose any.

Second attack there were 35 clubmean, taking their effective dpr again this equals a total of 70 damage dealt.
When damage is dealt it prioritizes kills before spread. So if the damage is enough to kill a unit it will, and the remaining damage will be split across the stack.

So in first attack you recieved 50 damage, and had a total of 30 hops. This gives you 56*30=1680 hp to spread the damage accross. This results in 1680-50=1630 hp left on your stack. Now divide by 30 again and you're left with 54.33 hp per hop. Take 54.33/56 and you have the result of 97% ish health. Ikariam rounds to lowest number so it displays 96%, but the true health is closer to 97%.

Now in your second attack you took 70 damage. Since it will prioritize kills, one unit starts off taking 56 damage. This leaves 70-56=14 health left to split. Doing the same as above: 1680-14=1666. 1666/30 = 55.53. 55.53/56=99%. And thus you're remaning stack is left with 99% health.