Dogs in large pack are more prone to attack, than one or two dogs, especially if they are not sterilized or castrated. It is in their nature. Usually, they will give a warning with barking not to approach them, but if they are surprised by your appearing, especially with quick movements, they can react immediately alongside barking. They most commonly threat when someone is entering their territory, especially if they move fast: run, ride a bike, rollerblade, ride a motorcycle, car...
If the situation where, one or more, dogs threatens you occurs, do not run away! That will encourage their intent. It will most probably awaken their basic instinct to chase after the prey. The ones that run after you will nibble your legs in order to topple you. Do not make sudden, unnatural moves, or raise your hands. Avoid eye-contact since it represents a challenge. Do not scream or yell because it will just encourage them more.
Instead of panicking and running away, stay calm. Show reassuring signals. With no eye-contact, but looking sideways and slightly towards the ground, start retreating slowly, without turning your back and with winking or yawning since these are reassuring signals. When you get far enough, turn sideways compared to the dog but keep it in your peripheral vision. If it moves towards you, turn again in its direction, look on the side slightly down again and start stepping backwards.
If the dog, or dogs, does not back off, but continues threatening, crouch down and pretend to grab a stone. This makes dogs more aggressive but keeps them further away. Sometimes it will make them run away.
If the dog, or dogs, attacks you, grab a stick, an umbrella, backpack, to protect yourself. Wrap a shirt or a jacket around your forearm. Do not hit it unless it comes to close to your personal space. Until then, use an improvised shield as a sign that you are not allowing further approaching and protect your face and head first. Continue walking backwards to leave dangerous territory. Still do not make direct eye-contact. Try not to panic.
The dog chases after you
While you jog, it is your advantage because you are more agile. You are the most in danger when on rollerblades, while a bike or a skateboard can be useful as shields. Get down from the bike and place it between yourself and the dog, and send it reassuring signals. Since running away and running are basically the same action, joggers are more exposed to dog reactions. This is why they should be careful when running, especially around dogs that are not used to runners. This is when you should slow down and start walking, and when far enough continue running.
If there is two of you, whether you are running or riding a bike, rollerblades or skateboards, and dogs try to swoop on you, turn each other back so you can protect others back, this way you are more protected both from front and back.