Replacing light fixture UK unable to determine which wire is which
One of those cables goes to a switch loop. You need to find out which. Open up the switch that controls this light and see what wire colours it has.

If the brown and blue (new colours) are the switch then connect


red to brown (which takes live to the switch)
blue to the "L" terminal of the the light - blue is switched live so you must  put red tape around the blue wire.
black to the "N" terminal of the light (neutral)
put a green/yellow sleeve over the bare earth wires and connect them using an approved connector. If the lamp has metal parts, they need to be connected to these earths too. The middle terminal in your second photo would probably be intended for this. Check for continuity between all metal parts and the earth wires.




UK Wiring colours

              Old       New
 Live         Red       Brown
 Neutral      Black     Blue